<div class="vheader">
    <h1><?php echo $this->translate("Loan information") ?></h1>
    <p><?php echo $this->Loans->d->ClientFullName ?>
</div>

<div class="vcontent">

    <img class="shadow" src="/default/photo/full/cat/i/id/<?php echo $this->Loans->d->ClientId ?>" />

    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Loan code") ?></dt>
            <dd><?php echo $this->Loans->d->LoanId ?></dd>
            <dt><?php echo $this->translate("Status") ?></dt>
            <dd><?php echo $this->Loans->d->Status ?></dd>
            <dt><?php echo $this->translate("Product") ?></dt>
            <dd><?php echo $this->Loans->d->LoanProductName ?></dd>
            <dt><?php echo $this->translate("Principal") ?></dt>
            <dd><?php echo $this->currency($this->Loans->d->Principal) ?></dd>
            <dt><?php echo $this->translate("Name") ?></dt>
            <dd><?php echo $this->link('/admin/client/view',array('id'=>$this->Loans->d->ClientId),$this->Loans->d->ClientFullName) ?>
                <?php echo $this->replaceEmpty($this->Loans->d->ClientNickName, '', '<br />') ?> <?php echo $this->Loans->d->ClientNickName ?>
                <?php echo $this->replaceEmpty($this->Loans->d->ClientCode, '', '<br />') ?> <?php echo $this->Loans->d->ClientCode ?></dd>
            <dt><?php echo $this->translate("Group") ?></dt>
            <dd><?php echo $this->replaceEmpty($this->Loans->d->GroupName, $this->translate("Individual")) ?>
                <?php echo $this->replaceEmpty($this->Loans->d->GroupName,'','<br />') ?>
                <?php echo $this->Loans->d->GroupId ?></dd>
            <dt><?php echo $this->translate("Business") ?></dt>
            <dd><?php echo $this->link('/admin/business/view',array('id'=>$this->Loans->d->BusinessId),$this->Loans->d->BusinessName) ?></dd>
            <dt><?php echo $this->translate("Business type") ?></dt>
            <dd><?php echo $this->Loans->d->BusinessType ?></dd>
            <dt><?php echo $this->translate("P. line") ?></dt>
            <dd><?php echo $this->Loans->d->ProductLine ?></dd>
            <dt><?php echo $this->translate("Program") ?></dt>
            <dd><?php echo $this->Loans->d->ProgramName ?></dd>
            <dt><?php echo $this->translate("Branch") ?></dt>
            <dd><?php echo $this->link('/admin/location/view',array('id'=>$this->Loans->d->LocationId),$this->Loans->d->LocationName) ?></dd>
            <dt><?php echo $this->translate("L. officer") ?></dt>
            <dd><?php echo $this->link('/admin/officer/view',array('id'=>$this->Loans->d->OfficerUserId),$this->Loans->d->OfficerFullName) ?></dd>
        </dl>
    </div>

    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Installments") ?></dt>
            <dd><?php echo $this->Loans->d->Installments ?> / <?php echo $this->Loans->d->PaymentFrequency ?></dd>
            <dt><?php echo $this->translate("Loan insurance") ?></dt>
            <dd><?php echo $this->Loans->d->LoanInsurancePct ?> %</dd>
            <dt><?php echo $this->translate("Health ins.") ?></dt>
            <dd><?php echo $this->Loans->d->HealthInsurancePct ?> %</dd>
            <dt><?php echo $this->translate("Admin. fee") ?></dt>
            <dd><?php echo $this->Loans->d->AdministrativeFeePct ?> %</dd>
            <dt><?php echo $this->translate("Annual pct. rate") ?></dt>
            <dd><?php echo $this->Loans->d->AnnualPercentageRate ?> %</dd>
            <dt><?php echo $this->translate("Principal grace rate") ?></dt>
            <dd><?php echo $this->Loans->d->PrincipalGraceRate ?> %</dd>
            <dt><?php echo $this->translate("Delay penalty rate") ?></dt>
            <dd><?php echo $this->Loans->d->DelayPenaltyRate ?> % - <?php echo $this->translate("Daily") ?></dd>
            <dt><?php echo $this->translate("Plty. fixed charge") ?></dt>
            <dd><?php echo $this->currency($this->Loans->d->DelayPenaltyFixedCharge) ?></dd>
            <dt><?php echo $this->translate("Delay grace") ?></dt>
            <dd><?php echo $this->Loans->d->DelayGrace ?> - <?php echo $this->translate("Day(s)") ?></dd>
            <dt><?php echo $this->translate("Mandatory savings") ?></dt>
            <dd><?php echo $this->currency($this->Loans->d->MandatorySavings) ?></dd>
            <dt><?php echo $this->translate("Voluntary savings") ?></dt>
            <dd><?php echo $this->currency($this->Loans->d->VoluntarySavings) ?></dd>
        </dl>    
    </div>

    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Delivery date") ?></dt>
            <dd><?php echo $this->Loans->d->DeliveryDate ?></dd>
            <dt><?php echo $this->translate("Exp. cancel date") ?></dt>
            <dd><?php echo $this->Loans->d->ExpectedCancelDate ?></dd>
            
            <dt></dt><dd></dd>
            
            <dt><?php echo $this->translate("Total balance") ?></dt>
            <dd><?php echo $this->currency((double) $this->Plan->getBalance()) ?></dd>
            <dt><?php echo $this->translate("Ppal. balance") ?></dt>
            <dd><?php echo $this->currency((double) $this->Loans->d->BalancePrincipal) ?></dd>
            
            <dt></dt><dd></dd>
            
            <dt><?php echo $this->translate("Next pmt. date") ?></dt>
            <dd><?php echo $this->Loans->d->NextPaymentDate ?></dd>
            <dt><?php echo $this->translate("Delay") ?></dt>
            <dd><?php echo $this->Loans->d->CurrentDelay ?>
                <?php echo $this->replaceEmpty($this->Loans->d->CurrentDelay,'', ' - ') ?>
                <?php echo $this->replaceEmpty($this->Loans->d->CurrentDelay,'', $this->translate("Days")) ?></dd>
            <dt><?php echo $this->translate("Pmt. amount") ?></dt>
            <dd><?php echo $this->currency((double) $this->Loans->d->ExpectedPaymentAmount) ?></dd>
            
            <dt></dt><dd></dd>
            
            <dt><?php echo $this->translate("Savings Bal.") ?></dt>
            <dd><?php echo $this->currency($this->Savings->Balance) ?></dd>
        </dl>    
    </div>
    
</div>

<!--
<div class="vgrid">
    <?php // echo $this->partial('partials/grid.phtml', $this->loanStatusChanges); ?>
</div>
-->    

<div class="vfooter">
    <div class="menu">
        <?php echo $this->link('/loan/application/view', array('id'=>$this->Loans->d->LoanMasterId),$this->translate("Master")) ?> 
        <?php echo $this->link('/loan/loan/status-changes', array('id'=>$this->Loans->d->LoanId),$this->translate("Status Changes")) ?>  
        <?php echo $this->link('/loan/loan/plan', array('id'=>$this->Loans->d->LoanId),$this->translate("Payment plan")) ?>  
        <?php if(($this->Loans->d->Status == 'Disbursed')&&($this->NextDuePayment['Date'] > date('Y-m-d'))): ?>
            <?php if($this->Savings->Balance > $this->NextDuePayment['Pmt']): ?>
                <?php echo $this->link('/loan/payment/principal', array('id'=>$this->Loans->d->LoanId),$this->translate("Payment on principal")) ?>
            <?php endif; ?>
            <?php if($this->Savings->Balance >= $this->Plan->getBalance()): ?>
                <?php // echo $this->link('/loan/payment/full', array('id'=>$this->Loans->d->LoanId),$this->translate("Pay in full")) ?>  
            <?php endif; ?>
        <?php endif; ?>
        <?php if(($this->Loans->d->Status == 'Written-Off')||(($this->Loans->d->Status == 'Recovered'))): ?>
            <?php echo $this->link('/loan/legal/view', array('id'=>$this->Loans->d->LoanId),$this->translate("Legal")) ?>   
        <?php endif; ?>
        <?php echo $this->printLink() ?>     
    </div>
</div>